<!DOCTYPE html>
<html>
<#include "/views/ftl/base/manager_include.ftl">
<script type="text/javascript" src="${basePath}js/My97DatePicker/WdatePicker.js"></script>
<base href="${basePath}">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>用户列表</title> 
<script type="text/javascript" charset="utf-8" src="ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="ueditor/ueditor.all.min.js"> </script> 
<script type="text/javascript" charset="utf-8" src="ueditor/lang/zh-cn/zh-cn.js"></script> 
</head>
<body style="background:#eef3f7;">
<#include "/views/ftl/base/head.ftl"> 
<div class="Main">
  <div class="dw">
<#include "/views/ftl/base/menu.ftl">
<#function a><#return "新闻列表_List"></#function> 

 
 <!--右边内容-->
      <div class="Rightbox fl">
        <!--面包屑-->
        <div class="Bread_crbs clear">
          <div class="Bread_crbs_img fl"></div>
          <div class="Bread_crbs_text fl"><a href="javascript:void(0);"><span>内容管理</span></a><span class="fnt_famy">></span><a href="javascript:void(0);"><span>内容列表</span></a></div>
        </div>
        <!--搜索框-->
        <form action="manager/News_newsList" method="POST">   
        	<span class="searchTitle sp">内容版块:</span>
           <select name="newsModulesId"  style="width:80px" >
					 
			</select> 
       	 <input class="search_btn" style="display: inline;" type="submit" value="搜索"/> 
        </form>
        <div class="clear"></div>   
        <!--表格列表-->
        <div class="Table">
          <table id="table" cellpadding="0" cellspacing="1">
            <tbody>
             <tr id="gl">
             <td  >链接</td>
             <td>内容版块</td> 
             <td>标题</td>
             <td>浏览量</td>  
             <td>操作</td> 
              </tr>
         <#if (pager.list??)> 
         <#if ((pager.list?size)>0)>
          <#list pager.list as bean>
     	<tr>
			<td >${basePath}news-${(bean.id)?c}.html</td>
          	<td>${(bean.newsModulesName)!''}</td>
          	<td>${(bean.newsTitle)!''}</td> 
           	<td>${bean.pageViews}</td>  
            <td class="tbl_btn"> 
            	<a href="manager/News_editNews?newsId=${(bean.id?c)}"><span id="editor">编辑</span></a> 
            	<s:if test="%{#bean.indexNo != 0 }">
            		<a href="javascript:upTop(${(bean.id?c)});" ><span id="green">置顶</span></a>
            		<a href="javascript:cancelUpTop(${(bean.id?c)});" ><span id="green">取消置顶</span></a>
            	</s:if><s:else>
            		<a href="javascript:upTop(${(bean.id?c)});" ><span id="green">置顶</span></a>
            	</s:else> 
            	<a href="javascript:dele(${(bean.id?c)});" ><span id="delete">删除</span></a>
            </td>
        </tr>
          </#list >
          </#if>
          </#if>
            </tbody>
          </table>
        </div>
     <!--翻页按钮-->
 	<#import "../../base/pager.ftl" as p>
   	<@p.pager pager = pager baseUrl = "manager/News_newsList" parameterMap={"newsModulesId":"${((requestVo.newsModulesId)?c)!''}" } />

      </div>
      </div> 
</div>
<script type="text/javascript">
function dele(id){
	if(confirm("确认要删除吗?")){
		$.ajax({
			url : "${basePath }manager/News_deleteNews",
			data : { 
				newsId : id,	
			}, 
			dataType :"JSON",
			cache : false, 
			type : "POST",
			success : function(dat){
				if(dat.code==1){
					alert(dat.msg);
					location.reload();	 
				} 
				if(dat.code==0){
					alert(dat.msg);	
				} 
			}
		});
	}
}
function upTop(id){
	if(confirm("确认置顶吗?")){
		$.ajax({ 
			url : "${basePath }manager/News_upTopNews",
			data : { 
				newsId : id,	
			}, 
			dataType :"JSON",
			cache : false, 
			type : "POST",
			success : function(dat){
				if(dat.code==1){
					alert(dat.msg);
					location.reload();	 
				} 
				if(dat.code==0){
					alert(dat.msg);	
				} 
			}
		});
	}
}
function cancelUpTop(id){
	if(confirm("确认要取消置顶吗?")){
		$.ajax({ 
			url : "${basePath }manager/News_cancelUpTopNews",
			data : { 
				newsId : id,	
			}, 
			dataType :"JSON",
			cache : false, 
			type : "POST",
			success : function(dat){
				if(dat.code==1){
					alert(dat.msg);
					location.reload();	 
				} 
				if(dat.code==0){
					alert(dat.msg);	
				} 
			}
		});
	}
}

$(function(){
	
	loadallNewsModules();
	function loadallNewsModules(){
		$.ajax({
				url : '${basePath }manager/NewsModules_allNewsModules', 
				data : {
				},
				dataType : "JSON",
				async : true,
				cache : false,  
				type  : "POST",
				success : function(data) {
					var html ='<option value="-1">全部</option>';
					html +='<option value="0">无分类</option>';
					if(1==data.code){
						 
						 $(data.data).each(function(index,bean){
						 		
						 		var x=bean.id;var optionValue='${newsModulesId}';     
								html+='<option value='+x+' '+(optionValue==x?"selected":"")+' >'+bean.modulesName+'</option>'; 
						 });
					}
					$('select[name=newsModulesId]').html(html);
				}
		});
	}
	
});
</script>
</body>
</html>